﻿using MiniFox.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MiniFox.Platform.OAuth2.Providers
{
    /// <summary>
    /// 
    /// </summary>
    [AutoRegister]
    public interface IAuthorizationProvider
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="appId">接入方id</param>
        /// <param name="fullURI">全路径</param>
        /// <returns>验证匹配是否成功</returns>
        bool CheckClient(string appId, string fullURI);
        /// <summary>
        /// 通过通行证令牌，创建授权码
        /// </summary>
        /// <param name="passportToken"></param>
        /// <param name="authCode"></param>
        /// <param name="appId"></param>
        /// <param name="scope"></param>
        /// <param name="context"></param>
        /// <param name="codeExpires"></param>
        /// <returns></returns>
        bool SaveAuthorizeCode(PassportToken passportToken, string authCode, string appId, string scope, string context, int codeExpires);
        
        /// <summary>
        /// 凭登录令牌重置密码
        /// </summary>
        /// <param name="ticketId">令牌id</param>
        /// <param name="oldPwd">旧密码</param>
        /// <param name="newPwd">新密码</param>
        /// <returns></returns>
        bool ResetPassword(string ticketId, string oldPwd, string newPwd);
    }
}
